package com.deyuanyun.pic.pbf.service;

import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.ApplicationEvent;

import javax.annotation.Resource;

/**
 * Created by linwei on 6/27/2016.
 */
public abstract class AbstractBaseService implements ApplicationContextAware {

    protected Logger logger = LogManager.getLogger(this.getClass());

    @Resource
    protected SqlSessionTemplate sqlSessionTemplate;

    private ApplicationContext applicationContext;


    protected void publishEvent(ApplicationEvent event) {
        applicationContext.publishEvent(event);
    }


    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        this.applicationContext = applicationContext;
    }
}
